package cn.hit.tianqiao.service.impl;

import cn.hit.tianqiao.dao.ReservationRepositoryDao;
import cn.hit.tianqiao.dao.impl.ReservationRepositoryDaoImpl;
import cn.hit.tianqiao.domain.Order;
import cn.hit.tianqiao.domain.Reservation;
import cn.hit.tianqiao.service.ReservationService;

import java.util.List;

public class ReservationServiceImpl implements ReservationService {
    private ReservationRepositoryDao reservationRepositoryDao = new ReservationRepositoryDaoImpl();

    @Override
    public Reservation saveReservation(Reservation reservation) {
        reservationRepositoryDao.save(reservation);
        return reservation;
    }

    @Override
    public List<Reservation> getAllReservations() {
        return reservationRepositoryDao.findAll();
    }

    @Override
    public List<Order> getReservationsByUserPhone(String userPhone) {
        return reservationRepositoryDao.findByUserPhone(userPhone);
    }
}
